<?php
/**
 * Servers as parent to the category models. Changes strictly disallowed without permission.
 * @author Administrator
 *
 */
abstract class CmsCategory extends AppModel
{
	var $fieldProperties = array(
		'id'=>array('group'=>array('index')),
		'name' => array('group' => array('add','index'),'validate'=>VALID_NOT_EMPTY)
	);
	
	function afterInitialize()
	{
		if($this->useTree() && $this->Behaviors->attached('Tree') == false)
		{
			$this->Behaviors->attach('Tree');
		}
		parent::afterInitialize();
	}
	function useTree()
	{
		return $this->hasField('parent_id');
	}
}
?>
